<template>
  <scroll-view scroll-y refresher-enabled class="scroll-view">
    <view class="scroll-view-wrapper">
      <view class="task-card">
        <navigator hover-class="none" url="/subpkg_task/detail/index?id=001">
          <view class="header">
            <text class="no">任务编号: XAHH1234567</text>
            <text class="status">已延迟</text>
          </view>
          <view class="body">
            <view class="timeline">
              <view class="line"
                >北京市昌平区回龙观街道西三旗桥东金燕龙写字楼8877号</view
              >
              <view class="line">河南省郑州市路北区北清路99号</view>
            </view>
          </view>
        </navigator>
        <view class="footer">
          <view class="label">提货时间</view>
          <view class="time">2022.05.04 13:00</view>
          <navigator
            hover-class="none"
            url="/subpkg_task/pickup/index"
            class="action"
            >提货</navigator
          >
        </view>
      </view>
      <view class="task-card">
        <navigator hover-class="none" url="/subpkg_task/detail/index?id=001">
          <view class="header">
            <text class="no">任务编号: XAHH1234567</text>
          </view>
          <view class="body">
            <view class="timeline">
              <view class="line"
                >北京市昌平区回龙观街道西三旗桥东金燕龙写字楼8877号</view
              >
              <view class="line">河南省郑州市路北区北清路99号</view>
            </view>
          </view>
        </navigator>
        <view class="footer">
          <view class="label">提货时间</view>
          <view class="time">2022.05.04 13:00</view>
          <button disabled class="action">提货</button>
        </view>
      </view>
      <view v-if="false" class="task-blank">无待提货物</view> 
    </view>
  </scroll-view>
</template>

<script setup>
  import { getTasksList } from '../api'
  import { ref, onMounted } from 'vue'
  const pageData = ref({
    page: 1, // 当前页
    pageSize: 4, // 每页容量
    status: 1, // 作业状态 1为待提货）、2为在途(在途和已交付)、3为改派、5为已作废、6为已完成（已回车登记）
  })
  const taskData = ref([])
  onMounted(async () => {
    const res = await getTasksList(pageData.value) // 获取任务列表
    console.log('🚀 ~ file: index.vue:11 ~ onLoad ~ res:', res)
    taskData.value = res.data.items
  })
</script>

<style lang="scss" scoped>
  @import './styles.scss';
</style>
